// 节流函数
// target: 目标函数
// timeout: 节流延时 毫秒
export default function (target: any, timeout: number) {
  let time = 0
  return (...rest: any) => {
    const nowTime: number = Date.now()
    if (nowTime - time >= timeout) {
      target(...rest)
      time = nowTime
    }
  }
}
